<% content_tag :div, :class => 'bigwrapper' do%>
	<%=h flash[:error] -%>
	<% content_tag :div, :class => 'editheader' do -%>
		<%= content_tag :img, nil, :src => '/images/icons/icons_03.png', :class => 'hleft' %>
		<%= content_tag :span, "<span class='smallgray'>edit action item </span>" + @action_item.first_entry.name, :class => 'hleft' %>
		<% content_tag :span, :class => 'editheadertext' do -%>
			<%= content_tag :strong, "Action item's current information:" -%>
			<%= content_tag :div, "<span class='smallgray'>Note </span>" + @action_item.first_entry.note -%>
			<%= content_tag :div, "<span class='smallgray'>Status </span>" + @action_item.first_entry.status -%>
			<%= content_tag :div, "<span class='smallgray'>Last modified by </span>" + @action_item.first_entry.created_by.fname -%>
			<%= content_tag :div, "<span class='smallgray'>Currently assigned to </span>" + @action_item.first_entry.assigned_to.fname -%>
		<% end -%>
		<% content_tag :div, :class => 'container' do -%>
			<%= content_tag :span, "<strong>All notes added to this action item: </strong>" -%>
		    <% for entry in @action_item_entries %>
				<% content_tag :div, :class => 'headertext' do -%>
		            <%= content_tag(:span, entry.created_at.strftime("%Y.%m.%d"), :class=>"smallgray") %>
					<%= content_tag(:span, entry.name) %>
					<%= content_tag(:span, "updated by " + entry.created_by.fname, :class => "smallgray") %>
					<%= content_tag(:div, entry.note) %>
				<% end -%>
		    <% end %>
			<% content_tag :div, :id => 'showoptions' do %>
		    	<% form_tag :action => 'edit' do -%>
					<% content_tag :div, :class => 'header' do %>
						<%= content_tag :label, "Add a note (<span class='red'>*</span>)<br/>"%>
						<%= text_area(:action_item_entry, :note, :size=>"46x5")%>
					<% end -%>
					<% content_tag :div, :class => 'header' do %>
						<%= content_tag :label, "Status (<span class='red'>*</span>):"%>
			            <%= select(:action_item_entry, :status, ["Opened","Closed"],:selected=>@action_item.first_entry.status) %>
					<% end -%>
					<% content_tag :div, :class => 'header' do %>
						<%= content_tag :label, "Title (<span class='red'>*</span>):"%>
			            <%= text_field(:action_item_entry, :name, :value=>@action_item.first_entry.name)%>
					<% end -%>
					<% content_tag :div, :class => 'header' do %>
						<%= content_tag :label, "Belongs to project (<span class='red'>*</span>):"%>
						<%= content_tag(:span,select(:action_item, :project_id, @projects.collect {|p| [p.first_entry.name, p.id]}, { :include_blank => true, :selected => @action_item.project_id }))%>
					<% end -%>
					<% content_tag :div, :class => 'header' do %>
						<%= content_tag :label, "Is due on (<span class='red'>*</span>):"%>
						<%= calendar_date_select :action_item_entry, :due, :value=>@action_item.first_entry.due.strftime("%a, %b %d %Y") %>
					<% end -%>
						<% content_tag :div, :class => 'header' do -%>
							<%= content_tag :label, "Is assigned to (<span class='red'>*</span>):" %>
							<%= content_tag(:span, select( :action_item_entry, :assigned_to_id, @users.collect {|u| [u.login, u.id]}, :selected => current_user.id ))%>
						<% end -%>
					<% content_tag :div, :class => 'header' do %>
			            <%= submit_tag 'Update Action Item' -%>
					<% end -%>
			    <% end %>
			<% end %>
			<% content_tag :div, :class => '' do -%>
				<%= content_tag :img, nil, :src => '/images/icons/icons_08.png', :class => 'icon' -%>
		    	<%= link_to_function "<strong>Add a note to this action</strong>", "$('showoptions').toggle()" -%>
			<% end -%>
			<%=  javascript_tag("$('showoptions').hide()") %>
		<% end -%>
	<% end -%>
<% end -%>